package com.zzedu.web.controller;

import com.zzedu.common.annotation.Log;
import com.zzedu.common.enums.BusinessType;
import com.zzedu.common.enums.OperatorType;
import com.zzedu.device.req.TeacherClassPageList;
import com.zzedu.device.req.TeacherPictureBookPageList;
import com.zzedu.device.rsp.ApiZzClassesInfoVO;
import com.zzedu.device.rsp.ApiZzPictureBookVO;
import com.zzedu.manager.ITeacherClassManager;
import com.zzedu.manager.IZzPictureBookManager;
import com.zzedu.result.Result;
import com.zzedu.utils.BaseReq;
import com.zzedu.utils.PageData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 教师班级管理Controller
 */
@RestController
@RequestMapping("teacherClass")
public class TeacherClassController {
    @Autowired
    ITeacherClassManager teacherClassManager;


    @Autowired
    IZzPictureBookManager pictureBookManager;
    /**
     * 班级列表
     *
     * @param req
     * @return
     */
    @PostMapping(value = {"/pageList"}, produces = {MediaType.APPLICATION_JSON_VALUE}, consumes = {MediaType.APPLICATION_JSON_VALUE})
    @Log(title = "班级列表", businessType = BusinessType.APP_STUDENT, operatorType = OperatorType.MOBILE)
    public Result<PageData<ApiZzClassesInfoVO>> pageList(@Validated @RequestBody BaseReq<TeacherClassPageList> req) {
        return teacherClassManager.pageList(req.getData());
    }

    /**
     * 班级绘本列表
     *
     * @param req
     * @return
     */
    @PostMapping(value = {"/teacherPictureBookPageList"}, produces = {MediaType.APPLICATION_JSON_VALUE}, consumes = {MediaType.APPLICATION_JSON_VALUE})
    @Log(title = "班级绘本列表", businessType = BusinessType.APP_STUDENT, operatorType = OperatorType.MOBILE)
    public Result<PageData<ApiZzPictureBookVO>> teacherPictureBookPageList(@Validated @RequestBody BaseReq<TeacherPictureBookPageList> req) {
        return pictureBookManager.teacherPictureBookPageList(req.getData());
    }
}
